<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
   <script>
    let obj = {
      name: 'kkk',
      age: 19
    }
    Object.defineProperty(obj, 'name', {
      value: 'lll', // 重设属性值
      writable: false, // 设为为不可写
      enumerable: false, // 设置为不可遍历
      configurable: false // 设置为不可删除
    })
    console.log(obj);  // {name: "lll", age: 19}

    obj.name = "张三"  // 验证修改特征 👇   ！！！严格模式下会报错
    console.log(obj);  // {name: "lll", age: 19}

    let a = Object.keys(obj);  // 验证是否可枚举 👇   ！！！严格模式下会报错
    console.log(a);  // ["age"] 不会出现‘name’属性

    delete obj.name;  // 验证是否可删除  👇   ！！！严格模式下会报错
    console.log(obj); // {name: "lll", age: 19}  属性未被删除

  </script>
</body>

</html>